SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
-- =============================================
-- Author:		Jonas
-- Create date: 22-01-2013
-- Description:	Retorna todos os eventos
-- =============================================
CREATE PROCEDURE [ext].[sp_fe_listarEventos_porCategoria] 
	@id int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT e.id_evento, e.id_utilizador,
		   e.id_categoria, e.data_inicio,
		   e.data_fim, e.titulo,
		   e.descricao, e.preco,
		   e.morada, e.codigo_postal,
		   e.url, e.contato_telefonico as contacto_telefonico,
		   e.email, e.latitude,
		   e.longitude,
		   u.UserName 
		   
	  FROM ext.evento e
	  inner join dbo.aspnet_Users u 
	  on e.id_utilizador = u.UserId 
	  WHERE e.id_categoria = @id
END
GO
